package org.shop.controller.user;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.shop.dao.UserInfoDao;
import org.shop.dao.impl.UserInfoDaoImpl;
import org.shop.entity.UserInfo;

/**
 * 查询用户（非分页）
 * 
 * 1.接收请求 2.处理请求 - 业务对象 - DAO对象 3.响应请求
 * 
 * 注意： / == http://localhost:8080/项目名称/
 * 
 * @author Administrator
 * 
 */
@WebServlet("/admin/queryAllUserInfo.do")
public class QueryAllUserInfoServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// 实例化Dao对象
		UserInfoDao userInfoDao = new UserInfoDaoImpl() ;
		
		// 查询所有的用户
		List<UserInfo> list = userInfoDao.selectAllUser();

		// 把数据存放在作用域对象中 - 请求作用域
		req.setAttribute("list", list);
		
		// 页面跳转到JSP中 - 转发
		req.getRequestDispatcher("listAllUserinfo.jsp").forward(req, resp);;

	}

}
